package com.zm.demo.core.base;

import org.junit.Test;

import java.util.Arrays;

/**
 * @desc:
 * @author: z01140
 * @date: 2021/5/19 16:45
 */
public class StringTest {

    @Test
    public void testReplace(){
        String sql = "bat";
        sql = sql.replace("bat", "bat_validate");
        System.out.println(sql);
    }

    @Test
    public void test1111(){
        Object[][] s1 = new Object[10][2];
        s1[1][0] = null;
        s1[1][1] = "1";

        System.out.println(s1);
    }

    @Test
    public void testCompare(){
        System.out.println("".compareToIgnoreCase("M1"));
        System.out.println("".compareToIgnoreCase("M1"));
        System.out.println("M0".compareToIgnoreCase("M1"));
        System.out.println("M1".compareToIgnoreCase("M1"));
        System.out.println("M2".compareToIgnoreCase("M1"));
        System.out.println("M2".compareToIgnoreCase(""));
    }

    @Test
    public void testsubstring(){
        String s = "12345,1,2,3,4,5,6";
        System.out.println(s.substring(s.indexOf(',')+1));
    }

    @Test
    public void testSplit(){
        String s = ",";
        String []ary = s.split(",");
        System.out.println(ary.length);
        System.out.println(Arrays.toString(ary));

        String s1 = ",1";
        String []ary1 = s1.split(",");
        System.out.println(ary1.length);
        System.out.println(Arrays.toString(ary1));

        String s2 = "2,";
        String []ary2 = s2.split(",");
        System.out.println(ary2.length);
        System.out.println(Arrays.toString(ary2));
    }
}
